package com.einmeer.controller;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.einmeer.entity.UmsAdmin;
import com.einmeer.service.UmsAdminService;
import com.einmeer.vo.ResultJson;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;
import java.time.LocalDate;

/**
 * <p>
 * 管理员表 前端控制器
 * </p>
 *
 * @author einmeer
 * @since 2024-03-18
 */
@RestController
@RequestMapping("/umsAdmin")
public class UmsAdminController {

    @Resource
    UmsAdminService umsAdminService;
    @GetMapping("/list")
    ResultJson<IPage<UmsAdmin>> list(Integer pageNo, Integer pageSize,String name){
        return ResultJson.success(umsAdminService.list(pageNo,pageSize,name));
    }

    @PostMapping("/add")
    ResultJson<Boolean> add(String name, String phone, String email, LocalDate birthday, String password, MultipartFile file){
        return ResultJson.success(umsAdminService.add(name, phone, email, birthday, password, file),"添加成功");

    }
// 要是表中的字段明有下划线怎么搞
    @GetMapping("/check")
    ResultJson<Boolean> check(String field,String value){
        return ResultJson.success(umsAdminService.check(field,value));
    }
}
